const ChooseFile = (options) => {
  if(typeof options ==='function'){
    options={success:options}
  }
  if (typeof options === 'object') {
    let input = document.createElement("input")
    document.body.appendChild(input)
    input.type = 'file'
    input.hidden='hidden'
    if (options.accept) {
      input.accept = options.accept
    }
    if (options.multiple != null) {
      input.multiple = options.multiple
    }
    input.click()
    input.onchange = (e) => {
      options.success(e.target.files)
      document.body.removeChild(input)
    }
  }
}
export default ChooseFile
